const state = () => ({
  province: {
    provinceData: {},
    allProvince: [],
  },
});

// getters
const getters = {};

// actions
const actions = {
  // 获取全部省份信息
  changeAllProvince({ commit }, proviList) {
    commit('setAllProvince', proviList);
  },
  changeProvince({ commit }, pro) {
    commit('setProvince', pro);
  },
  changeProvinceName({ commit }, proName) {
    commit('setProvinceName', proName);
  },
};

// mutations
const mutations = {
  setProvince(state, pro) {
    state.province.provinceData = pro;
  },
  setProvinceName(state, proName) {
    state.province.provinceData = proName;
  },
  setAllProvince(state, proviList) {
    state.province.allProvince = proviList;
  },
};

export default {
  namespaced: true,
  state,
  getters,
  actions,
  mutations,
};
